package url;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

public class GetLineCode {
	public static void main(String[] args) throws IOException {
		URL url=new URL("http://www.9bugs.com/"); //要获取的url
		URLConnection urlconn=url.openConnection(); //取得链接,返回URLConnection
		
		InputStream is=urlconn.getInputStream();//获得输入流,返回InputStream
		InputStreamReader isr=new InputStreamReader(is,"UTF-8");//可以设置编码
		BufferedReader br=new BufferedReader(isr);
		
		String line;
		while((line=br.readLine())!=null)
		{
			System.out.println(line);
		}
	}
}
